From: Björn Daase Date: Tue, 15 Feb 2022 10:21:48 +0000 (+0100) Subject: dateMenu: Don't manipulate passed events X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~516^2^2~59 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0fded45c7604e5df546418e9e7bfdc0c6245d1d9;p=gnome-shell.git dateMenu: Don't manipulate passed events The event passed to formatEventTime() is reused at a later point. Therefore, we are not allowed to manipulate the event directly. This fixes an issue where the user clicks on a multi-day all-day event the second time before the event gets garbage collected and the event then is one day shorter. Fixes 528ee01fef6e5ca2303fc766be29a854d8ee928b Part-of: --- diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index 8ed1a579b..55c12ebe1 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -175,7 +175,7 @@ class EventsSection extends St.Button { _formatEventTime(event) { const eventStart = event.date; - const eventEnd = event.end; + let eventEnd = event.end; const allDay = eventStart.getTime() === this._startDate.getTime() && eventEnd.getTime() === this._endDate.getTime(); @@ -203,8 +203,10 @@ class EventsSection extends St.Button { const startYear = eventStart.getFullYear(); - if (endsAtMidnight) + if (endsAtMidnight) { + eventEnd = new Date(eventEnd); eventEnd.setDate(eventEnd.getDate() - 1); + } const endYear = eventEnd.getFullYear();